When finding nearest friend, skip the dying ones as well #398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some talkmonster code leads to the monster changing their schedule.
hlsdk-portable/dlls/talkmonster.cpp
Lines 1154 to 1161 in 17b34aa
hlsdk-portable/dlls/talkmonster.cpp
Lines 1140 to 1145 in 17b34aa
The
FindNearestFriend
(used in both cases) can return a dying (but not dead yet) monster becauseIsAlive
is implemented differently for monsters (it returns true if monster is in dying animation).To reproduce the bug:
The first barney will play a death sound two times because at the time when the second barney takes damage, it makes the first barney change his schedule to
slIdleStopShooting
, and then he gets back to the dying schedule since he's in the dead state, playing the death sound again viaTASK_SOUND_DIE
.Same thing potentially can happen if the monster that is chosen to answer the question is dying at the moment of question being asked, but it's harder to reproduce.